//验证手机号
export function verifyPhone(rule: object, value: string, callback: (err?: Error) => void) {
    let reg = /^[1][3, 4, 5, 6, 7, 8, 9][0-9]{9}$/
    if (!reg.test(value)) {
        return callback(new Error('请输入正确的手机号码!'))
    }
    callback()
}

//验证身份证号
export function verifyCardId(rule: object, value: string, callback: (err?: Error) => void) {
    let reg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/
    if (!reg.test(value)) {
        return callback(new Error('请输入正确的身份证号码!'))
    }
    callback()
}